package com.int_tech.utils;

import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by liubochao on 2018/6/23.
 */
public class TimePlus {

    public static String gongshiTimePlus(Date time1, Date time2, int beishu) throws ParseException {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        Date now = df.parse(DateTool.Date2String(time1,"yyyy-MM-dd HH:mm:ss"));

        Date date=df.parse(DateTool.Date2String(time2,"yyyy-MM-dd HH:mm:ss"));

        long l=now.getTime()-date.getTime();

        long day=l/(24*60*60*1000);

        long hour=(l/(60*60*1000)-day*24);

        long min=((l/(60*1000))-day*24*60-hour*60);

        long s=(l/1000-day*24*60*60-hour*60*60-min*60);

        float t = min;

        /*float ht = t/(1000*60*60);

        ht = ht/beishu;

//        DecimalFormat fnum  =   new  DecimalFormat("##0.0");

        DecimalFormat formater = new DecimalFormat("#0.#");
        formater.setRoundingMode(RoundingMode.FLOOR);


        String times=formater.format(ht);*/

//        System.out.println(""+day+"天"+hour+"小时"+min+"分"+s+"秒");

        return String.valueOf(t);
    }
}
